<template>
  <div class="evaluate">
    <van-sticky>
      <van-nav-bar title="评价" left-arrow @click-left="back" />
    </van-sticky>
    <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="getData">
      <div class="list van-hairline--bottom" v-for="(item,index) in dataList" :key="index">
        <div class="row-between-center">
          <div class="user row-between-center">
            <div class="head">
				<img :src="item.userHead" style="width: 100%; height: 100%;border-radius: 50%;" alt="">
			</div>
            <div class="text">
              <p class="name">{{item.userName}}</p>
              <van-rate v-model="item.quality" readonly />
            </div>
          </div>
          <span class="time">{{item.insertTime}}</span>
        </div>
        <div class="tags">
          <span class="tag">服务态度<i></i>{{item.attitude}}</span>
          <span class="tag">服务质量<i></i>{{item.quality}}</span>
          <span class="tag">办理速度<i></i>{{item.speed}}</span>
        </div>
        <p class="text">{{item.evaContent}}</p>
      </div>
    </van-list>
  </div>
</template>

<script>
import api from 'api/api'
export default {
  data () {
    return {
      star: 5,
      dataList: [],
      loading: false,
      finished: false,
      form: {
        data: {
          goodId: '',
          page: 0,
          limit: 10,
		  type:''
        }
      }
    }
  },
  created () {
    this.form.data.goodId = this.$route.params.id
	this.form.data.type=this.$route.params.type
    this.getData()
  },
  methods: {
    getData () {
      // if (!this.finished && !this.loading) {
        this.form.data.page++
        this.loading = true;
        api.evaluationList(this.form).then(res => {
          this.loading = false;
          this.dataList = this.dataList.concat(res.data.records)
		 console.log( this.dataList)
          this.pages = res.data.pages
          if (this.form.data.page > this.pages - 1) {
            this.finished = true
          }
        })
      // }
    },
    back () {
      window.history.go(-1)
    }
  }
}
</script>

<style lang="scss">
.evaluate {
  .list {
    text-align: left;
    padding: 0.27rem;
    .user {
      .head {
        width: 0.6rem;
        height: 0.6rem;
        border-radius: 50%;
		background-size: cover;
		// margin-top: -0.8rem;
		margin: -0.8rem 0.2rem 0 0;
      }
      .name {
        font-size: 0.28rem;
      }
    }
    .time {
      font-size: 0.22rem;
      color: #999;
    }
    .tags {
      display: flex;
      padding: 0.2rem 0;
      .tag {
        padding: 0.11rem;
        font-size: 0.24rem;
        border: 0.01rem solid rgba(153, 153, 153, 1);
        border-radius: 0.03rem;
        margin-right: 0.13rem;
        display: flex;
        align-items: center;
        i {
          margin: 0 0.11rem;
          display: inline-block;
          height: 0.29rem;
          border-left: 0.01rem solid rgba(153, 153, 153, 1);
        }
      }
    }
    .text {
      font-size: 0.24rem;
    }
  }
}
</style>